package com.ss.ttvideoengine.d;

import java.util.HashMap;

public final class TTVideoError {
    public int code;
    public String domain;
    public String description;
    private int internalCode;

    public TTVideoError(String domain, int code, String description) {
        this(domain, code, 0, description);
    }

    public TTVideoError(String domain, int code, int internalCode, String description) {
        this.domain = domain;
        this.code = code;
        this.internalCode = internalCode;
        this.description = description;
    }

    public TTVideoError(String domain, int code) {
        this(domain, code, 0, null);
    }

    public final HashMap<String,Object> toMap() {
        HashMap hashMap = new HashMap();
        hashMap.put("domain", this.domain);
        hashMap.put("code", this.code);
        if (this.internalCode != 0) {
            hashMap.put("internalCode", Integer.valueOf(this.internalCode));
        }
        if (this.description != null) {
            hashMap.put("description", this.description);
        }
        return hashMap;
    }

    public final boolean b() {
        return this.code == -499999
                || this.code == -499997
                || this.code == -499996
                || this.code == -499992
                || this.code == -499991
                || this.code == -499990
                || this.code == -499989;
    }

    public final String toString() {
        return String.format("domain:%s, code:%d, internalCode:%d, description:%s",
                domain,
                code,
                internalCode,
                this.description != null ? this.description : "");
    }
}

